package com.example.sentence.Controller;

import com.example.sentence.entity.Senten;
import com.example.sentence.service.SentenceService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author Xiaokun
 */
@Controller
public class HomeController {
    @Resource
    private SentenceService sentenceService;

    @RequestMapping("/")
    public String Index(Model model){
        List<Senten> all = sentenceService.findAll();
        model.addAttribute("list",all);
        model.addAttribute("hello","wocaonimade");
        return "idnex";
    }

    public String save(@Validated Senten senten){

        return null;
    }
}
